package com.banshuibao.bsb_android.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.banshuibao.bsb_android.R;
import com.banshuibao.bsb_android.model.DealModel;
import com.banshuibao.bsb_android.util.PriceUtil;
import com.banshuibao.bsb_android.util.TimeUtil;

import java.util.List;

/**
 * Created by Administrator on 2017/12/20.
 */

public class IncomeAdapter extends MineBaseAdapter<DealModel.DataBean> {

    public IncomeAdapter(Context context, List<DealModel.DataBean> data, int layoutResId) {
        super(context, data, layoutResId);
    }

    @Override
    protected void bindData(ViewHolder holder, DealModel.DataBean item) {
        TextView content = (TextView) holder.getView(R.id.all_title);
        ImageView imageView = (ImageView) holder.getView(R.id.all_iv);
        TextView date = (TextView) holder.getView(R.id.all_date);
        TextView income = (TextView) holder.getView(R.id.all_income_money);
        TextView pay = (TextView) holder.getView(R.id.all_pay_money);
        content.setText(item.getGoodsType());
        String time = null;
        if (item.getCreateDate() != 0) {
            time = TimeUtil.format(item.getCreateDate());
        } else {
            time = "";
        }
        date.setText(time);

        imageView.setImageResource(R.drawable.icon_buy_money);
        pay.setVisibility(View.GONE);
        income.setVisibility(View.VISIBLE);
        income.setText("+" + PriceUtil.FormatDecimal(item.getPrice()) + "元");
    }
}
